class Lazy {
    constructor() {

    }
    init() {
        // alert(1)
        $.ajax({
            url: 'http://localhost/lining/backend/liningapi.php',
            dataType: 'json'
        }).then(function(resData) {
            // console.log(resData);
            let htmlStr = "";
            $.each(resData, function(index, value) {
                htmlStr += `
            <li>
              <a href="detail.html?sid=${value.sid}" target="_blank">
                <img data-original="${value.url}" class="lazy"/>
                <p>${value.title}</p>
                <span>${value.price}</span>
              </a>
            </li>
        `;
            });

            $('.list').html(htmlStr);

            // 懒加载
            $("img.lazy").lazyload({
                effect: "slideDown"
            });

        });
    }
}

export {
    Lazy
}